package com.real8.romemp.client.place;

import com.google.gwt.place.shared.Place;
import com.google.gwt.place.shared.PlaceTokenizer;

public class HireAuxiliaPlace extends Place {
	public enum EMenuSelection {
		NONE, HIRE, FIRE, DO_NOTHING
	}

	private EMenuSelection menuOption;

	public HireAuxiliaPlace() {
		this(EMenuSelection.NONE);
	}

	public HireAuxiliaPlace(EMenuSelection menuOption) {
		this.menuOption = menuOption;
	}

	public EMenuSelection getMenuOption() {
		return menuOption;
	}

	public static class Tokenizer implements PlaceTokenizer<HireAuxiliaPlace> {
		@Override
		public String getToken(HireAuxiliaPlace place) {
			return place.getMenuOption().toString();
		}

		@Override
		public HireAuxiliaPlace getPlace(String token) {
			// determine menuOption
			EMenuSelection menuOption = EMenuSelection.NONE;
			if (token.equalsIgnoreCase(EMenuSelection.HIRE.toString())) {
				menuOption = EMenuSelection.HIRE;
			} else if (token.equalsIgnoreCase(EMenuSelection.FIRE.toString())) {
				menuOption = EMenuSelection.FIRE;
			} else if (token.equalsIgnoreCase(EMenuSelection.DO_NOTHING
					.toString())) {
				menuOption = EMenuSelection.DO_NOTHING;
			}

			// end
			return new HireAuxiliaPlace(menuOption);
		}
	}
}
